using System;
using System.Collections.Generic;
using System.Text;

namespace AUSRIS.Reports.Utilities.Deployment.Entities
{
	/// <summary>
	/// Base class for items deployed to the reportserver
	/// </summary>
	public abstract class DeploymentItem
	{
		#region Private Fields

		private string name;
		private string description;
		private bool hidden;
		private IList<ItemPolicy> policies;
		private Folder parentFolder;

		#endregion

		#region Constructor(s)

		public DeploymentItem(string name, Folder parentFolder)
		{
			this.name = name;
			this.policies = new List<ItemPolicy>();
			this.description = "";
			this.parentFolder = parentFolder;
		}

		#endregion

		#region Public Properties

		public string Description
		{
			get
			{
				return description;
			}
			set
			{
				description = value;
			}
		}

		public string Name
		{
			get
			{
				return name;
			}
		}

		public Folder ParentFolder
		{
			get
			{
				return this.parentFolder;
			}
		}

		public bool Hidden
		{
			get
			{
				return hidden;
			}
			set
			{
				hidden = value;
			}
		}

		public IList<ItemPolicy> Policies
		{
			get
			{
				return policies;
			}
		}

		public string Path
		{
			get
			{
				if ( this.parentFolder == null )
				{
					return this.Name;
				}
				return this.parentFolder.Path + @"/" + this.Name;
			}
		}

		public String ParentPath
		{
			get
			{
				if ( this.parentFolder == null )
				{
					return @"/";
				}
				return @"/" + this.parentFolder.Path;
			}
		}

		#endregion
	}
}